//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package study.API;

public class StringBuilderDemo {
    public StringBuilderDemo() {
    }

    public static void main(String[] args) {
        StringBuilder sb1 = new StringBuilder();
        sb1.append("abcde");
        System.out.println(sb1.length());
        System.out.println(sb1.capacity());
        sb1.append("fghijklmnopqrstuvwxyz");
        System.out.println(sb1.length());
        System.out.println(sb1.capacity());
        sb1.append("0123456789");
        System.out.println(sb1.length());
        System.out.println(sb1.capacity());
        sb1.append("ABCDFGHIGKLMNOPQRSTUVWXYZAAAAAAAAAAAAA");
        System.out.println(sb1.length());
        System.out.println(sb1.capacity());
        System.out.println(demo1("123321"));
        System.out.println(demo2(new int[]{1, 2, 3}));
    }

    public static String demo1(String str) {
        String newStr = (new StringBuilder(str)).reverse().toString();
        return str.equals(newStr) ? "是" : "不是";
    }

    public static String demo2(int[] arr) {
        StringBuilder sb = new StringBuilder("[");

        for(int i = 0; i < arr.length; ++i) {
            sb.append(arr[i]).append(",");
        }

        sb.deleteCharAt(sb.length() - 1).append("]");
        return sb.toString();
    }
}
